﻿<phone:PhoneApplicationPage 
    x:Class="AzureTracer.Views.LoginPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"    
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
    xmlns:my="clr-namespace:AzureTracer.Views.Controls"
  
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait" Orientation="Portrait"
    mc:Ignorable="d" d:DesignHeight="768" d:DesignWidth="480"
    shell:SystemTray.IsVisible="True"
    DataContext="{Binding Login, Source={StaticResource Locator}}">

    <!--Transitions-->
    <toolkit:TransitionService.NavigationInTransition>
        <toolkit:NavigationInTransition>
            <toolkit:NavigationInTransition.Backward>
                <toolkit:SlideTransition Mode="SlideUpFadeIn"/>
            </toolkit:NavigationInTransition.Backward>
            <toolkit:NavigationInTransition.Forward>
                <toolkit:SlideTransition Mode="SlideUpFadeIn"/>
            </toolkit:NavigationInTransition.Forward>
        </toolkit:NavigationInTransition>
    </toolkit:TransitionService.NavigationInTransition>
    <toolkit:TransitionService.NavigationOutTransition>
        <toolkit:NavigationOutTransition>
            <toolkit:NavigationOutTransition.Backward>
                <toolkit:SlideTransition Mode="SlideDownFadeOut"/>
            </toolkit:NavigationOutTransition.Backward>
            <toolkit:NavigationOutTransition.Forward>
                <toolkit:SlideTransition Mode="SlideDownFadeOut"/>
            </toolkit:NavigationOutTransition.Forward>
        </toolkit:NavigationOutTransition>
    </toolkit:TransitionService.NavigationOutTransition>

    <!--LayoutRoot is the root grid where all page content is placed-->
    <Grid x:Name="LayoutRoot" Background="Transparent">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <!--TitlePanel contains the name of the application and page title-->
        <StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">
            <TextBlock x:Name="ApplicationTitle" 
                       Text="{Binding Labels.Login, Source={StaticResource LabelsManager}}"
                       Style="{StaticResource PhoneTextNormalStyle}"/>
            <StackPanel Orientation="Horizontal" Margin="0,8,0,0">
                <Border BorderThickness="0" HorizontalAlignment="Left" VerticalAlignment="Top" Width="50" Height="50" Padding="0" Margin="10,0,0,0">
                    <Border.Background>
                        <ImageBrush Stretch="Uniform" ImageSource="/Resources/Images/Cloud.png"/>
                    </Border.Background>
                </Border>
                <TextBlock  
                    FontWeight="Bold" FontSize="28" 
                    Text="{Binding Labels.AppTitle, Source={StaticResource LabelsManager}}" 
                    VerticalAlignment="Center" Margin="10,0,0,0" />
            </StackPanel>
        </StackPanel>

        <!--ContentPanel - place additional content here-->
        <ScrollViewer x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
            <StackPanel>
                <TextBlock 
                        Text="{Binding Labels.AccountName,Source={StaticResource LabelsManager}}"
                        Padding="3,0,0,0"/>
                <toolkit:PhoneTextBox 
                        Text="{Binding AccountName,Mode=TwoWay}" 
                        Hint="{Binding Labels.AccountNameHint,Source={StaticResource LabelsManager}}" 
                        InputScope="EmailUserName"/>
                <TextBlock 
                        Text="{Binding Labels.AccountKey,Source={StaticResource LabelsManager}}" 
                        Margin="0,18,0,0"/>
                <toolkit:PhoneTextBox 
                        Text="{Binding AccountKey,Mode=TwoWay}" 
                        Hint="{Binding Labels.AccountKeyHint,Source={StaticResource LabelsManager}}"
                        Height="204" InputScope="Default" TextWrapping="Wrap" 
                        DisplayedMaxLength="88" LengthIndicatorVisible="True"/>
                <Button 
                    Command="{Binding LoginCommand}" 
                    IsEnabled="{Binding StateInfo.IsNotLoading}"
                    Content="{Binding Labels.Login, Source={StaticResource LabelsManager}}"/>
                <TextBlock  
                    Text="{Binding Labels.LoginHint, Source={StaticResource LabelsManager}}" 
                    TextWrapping="Wrap" TextAlignment="Center" />
            </StackPanel>
        </ScrollViewer>

        <my:ProgressIndicatorProxy 
            IsIndeterminate="{Binding StateInfo.IsLoading}"  
            Text="{Binding StateInfo.Text}"  
            IsVisible="{Binding StateInfo.IsVisible}" />
    </Grid>

</phone:PhoneApplicationPage>
